wayland: Free the internal selection data when the selection is cleared
authorRob Bradford <rob@linux.intel.com>
Fri, 13 Jan 2012 16:34:11 +0000 (16:34 +0000)
committerRob Bradford <rob@linux.intel.com>
Fri, 13 Jan 2012 16:50:47 +0000 (16:50 +0000)
gdk/wayland/gdkdevice-wayland.c

index 26faad8ac5da7c8b69e909649f176f153a8b3f2f..39b24173217391efd30ef2ce15f9d884915afd0d 100644 (file)
@@ -787,6 +787,17 @@ data_device_selection (void                  *data,
   g_debug (G_STRLOC ": %s wl_data_device = %p wl_data_offer = %p",
            G_STRFUNC, wl_data_device, offer);
 
+  if (!offer)
+    {
+      if (device->selection_offer)
+        {
+          data_offer_unref (device->selection_offer);
+          device->selection_offer = NULL;
+        }
+
+      return;
+    }
+
   if (device->selection_offer)
     {
       data_offer_unref (device->selection_offer);